package com.killers.cold.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class RdiesTest {
    private final Logger log = LoggerFactory.getLogger(RdiesTest.class);

    @Autowired
    RedisTemplate redisTemplate;

    @ResponseBody
    @RequestMapping(value = "/resdis",method = RequestMethod.GET)
    private String setHello(){
        ValueOperations<String, String> ops = redisTemplate.opsForValue();
        ops.set("123","hello");
        return "Success";
    }
    @ResponseBody
    @RequestMapping(value = "/deleteResdis",method = RequestMethod.DELETE)
    private String getHello(){
        ValueOperations<String, String> ops = redisTemplate.opsForValue();
       return ops.get("123");

    }
}
